#include<iostream>
using namespace std;

int TwoSum(int a, int b)
{
    int cnt = 0;
    for (int i = a; i <= b; i++)
    {
        int n = i;
        while (n)
        {
            if (n % 10 == 2)
            {
                cnt++;
            }
            n /= 10;
        }
    }
    return cnt;

}
int main()
{
    int a, b;
    cin >> a >> b;
    int ret = TwoSum(a, b);
    cout << ret << endl;
    return 0;
}